<template>
  <div v-if="Object.keys(detailInfo).length !==0" class="goods-info">
    <div class="info-dese clear-fix">
      <div class="start"></div>
      <div class="desc">{{detailInfo.desc}}</div>
      <div class="end"></div>
    </div>
    <div class="info-key">{{detailInfo.detailImage[0].key}}</div>
    <div class="info-list">
      <img v-for="(item,index) in detailInfo.detailImage[0].list"
           :key="index"  :src="item" @load="imgLoad">
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailGoodsInfo',
  props:{
    detailInfo:{
      type:Object
    }
  },
  data(){
    return{
      counter:0,
      imagesLength:0
    }
  },
  methods:{
    imgLoad(){
      if (++this.counter ===this.imagesLength){
        this.$emit('imageLoad')
      }
    }
  },
  watch:{
    detailInfo(){
      this.imagesLength=this.detailInfo.detailImage[0].list.length
    }
  }
}
</script>

<style scoped>
.goods-info{
  padding:0px 0 20px 0;
  border-bottom: 5px solid #f2f5f8;
  margin-top: -15px;
  z-index: 9;
}
.info-dese .desc{
  font-size: 18px;
  padding: 0px 10px;
}
.info-key{
  font-size: 18px;
  padding-left: 10px;
  margin-top: 10px;
  margin-bottom: 5px;
  color: rgba(255,0,151,0.8);
}
.info-list{
  z-index: 99;
}
.info-list img{
  height: 20em;
  width: 100%;
}
.info-list img:last-child{
  height: 10em;
}
</style>
